package day07;

import com.sun.xml.internal.ws.api.server.SDDocument;

import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
       /*
        Scanner scan=new Scanner(System.in);
        int num=(int )(Math.random()*1000+1);
System.out.println(num);
        System.out.println("猜吧！");

        while(true){//自造死循环
            int guess=scan.nextInt();
            if(guess>num){
                System.out.println("猜大了,再试一试");
            }else if(guess<num){
                System.out.println("猜小了，再试一试");
            }else{
                System.out.println("恭喜你，猜对了！！！");
                break;//退出死循环

        */

        Scanner scan=new Scanner(System.in);
        int num=(int )(Math.random()*100);
        System.out.println("猜吧！");
        while(true){
            int guess=scan.nextInt();
            if(guess>num){
                System.out.println("猜大了，再试一次");
            }else if(guess<num){
                System.out.println("猜小了，再试一次");
            }else{
                System.out.println("恭喜你，猜对了！！！");
                break;
            }
        }

    }
}
